package com.csyaonie.android;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;

import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.csyaonie.android.utils.NotificationUtil;

public class NotificationActivity extends AppCompatActivity {

    Button ntbt1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_notification);
        NotificationUtil.initNotificationManager(this);

        ntbt1=findViewById(R.id.ntbt1);
        ntbt1.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                Notification notification=new NotificationCompat.Builder(NotificationActivity.this,"musicNotification")
                        .setAutoCancel(true)
                        .setContentTitle("title").setContentText("content")
                        .setWhen(System.currentTimeMillis())
                        .setSmallIcon(R.drawable.alpay).setLargeIcon(BitmapFactory
                        .decodeResource(getResources(),R.drawable.beauty)).build();

                NotificationUtil.notificationManager.notify(1,notification);
            }
        });
    }
}